package com.demo.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectExchangeConfig {

    @Bean
    public Queue queueDemo(){

        return new Queue("s59",true);
    }

    @Bean
    DirectExchange directExchangeDemo(){
        return new DirectExchange("BookOrder",true,false);
    }

    @Bean
    Binding binding(){
        Binding binding = BindingBuilder.bind(queueDemo())
                .to(directExchangeDemo()).with("direct-queue-key");
        return binding;
    }
}